<!DOCTYPE html>
<html lang="zh-cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" th:href="@{/css/pintuer.css}">
    <link rel="stylesheet" th:href="@{/css/admin.css}">
    <script th:src="@{/js/jquery.js}"></script>
    <script th:src="@{/js/pintuer.js}"></script>
</head>
<body>
<form method="post" th:action="@{'/folderManage/list/'+${session.user.uid}}" id="listform">
    <!-- 用隐藏域保存页号 -->
    <input type="hidden" name="currentPage" id="currentPage" value="1">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href=""
                                                                               style="float:right; display:none;">添加字段</a>
        </div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <li><a class="button border-main icon-plus-square-o" th:href="@{/toDirAdd}"> 添加文件夹</a></li>
                <li>
                    <input type="text" placeholder="请输入搜索关键字" name="keyword" class="input" th:value="${keyword}"
                           style="width:250px; line-height:17px;display:inline-block"/>
                    <a href="javascript:void(0)" class="button border-main icon-search" onclick="changePageNum(1)">
                        搜索</a></li>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th width="10%">编号</th>
                <th>文件夹名</th>
                <th>备注</th>
                <th width="310">操作</th>
            </tr>
            <tr th:each="item:${pageInfo.list}">
                <td th:text="${item.tid}"></td>
                <td th:text="${item.tname}"></td>
                <td th:text="${item.tremark}"></td>
            </tr>
            <tr>
                <td colspan="4">
                    <span>当前页</span><span th:text="${pageInfo.pageNum}+'/'+${pageInfo.pages}"></span><span>总页数</span>

                    <div class="pagelist">
                        <a href="javascript:void(0)" th:onclick="|changePageNum(${pageInfo.isFirstPage}?${pageInfo.navigateFirstPage}:${pageInfo.prePage})|">上一页</a>
                        <a href="javascript:void(0)" th:each="pageNum:${pageInfo.navigatepageNums}" th:text="${pageNum}"
                           th:onclick="|changePageNum(${pageNum})|"></a>
                        <a href="javascript:void(0)" th:onclick="|changePageNum(${pageInfo.isLastPage}?${pageInfo.navigateLastPage}:${pageInfo.nextPage})|">下一页</a>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</form>

<script>
    //搜索
    function changePageNum(pageNum) {
        $("#currentPage").val(pageNum);
        $("#listform").submit();
    }
</script>
</body>
</html>